package systemClasses;

public class Message {
	
	private String receiver;
	private String subject;
	private String message;
	private String iD;
	private User sender;
	
	public Message(String receiver, String subject, String message) throws Exception{
		setReceiver(receiver);
		setSubject(subject);
		setMessage(message);
	}
	
	public void setReceiver(String receiver) throws Exception{
		if(receiver == null || receiver.equals(""))
			throw new Exception("Destinatário inválido");
		
		this.receiver = receiver;
	}
	
	public void setSubject(String subject) throws Exception{
		if(subject == null || subject.equals(""))
			throw new Exception("Assunto inválido");
		
		this.subject = subject;
	}
	
	public void setMessage(String message) throws Exception{
		if(message == null || message.equals(""))
			throw new Exception("Mensagem inválida");
		
		this.message = message;
	}
	
	public void setID(String iD) throws Exception{
		if(iD == null || iD.equals(""))
			throw new Exception("Identificação inválida");
		
		this.iD = iD;
	}
	
	public void setSender(User sender) throws Exception{
		if(sender == null)
			throw new Exception("Remetente inválido");
		
		this.sender = sender;
	}
	
	public String getReceiver(){
		return receiver;
	}
	
	public String getSubject(){
		return subject;
	}
	
	public String getMessage(){
		return message;
	}
	
	public String getID(){
		return iD;
	}
	
	public User getSender(){
		return sender;
	}
}